Learn about difference between undefined and null, we have the largest and most updated difference between undefined and null information on alibabacloud.com
Before the cloud-dwelling community sent a similar articleJavaScript null and undefined difference analysisJavaScript undefined,null type and nan value differenceLet's talk about undefined:The variables in JavaScript are weakly typed (I don't need
1. Type analysis:JS data types have undefined,boolean,number,string,object, such as 5, the first 4 are the original type, the 5th is the reference type.CodeCode highlighting produced by Actipro Codehighlighter (freeware)
Null: indicates no value;Undefined: Represents an undeclared variable, or a variable that has been declared but not assigned a value, or an object property that does not exist. The = = operator considers the two equal. If you want to differentiate
Most computer languages have and have only one value that represents "none", for example, the Null,java language of the C language, the Null,python language of the None,ruby language of nil.Oddly enough, the JavaScript language actually has two
Most computer languages have and have only one value that represents "none", for example, the Null,java language of the C language, the Null,python language of the None,ruby language of nil.Oddly enough, the JavaScript language actually has two
A bad time to answer, especially undefined, because this involves the realization of the principle of undefined. So, after thinking carefully, write down this article, please heroes to shoot bricks.
Total known: null = = undefined
However: null!==
Here is a collection of JS in the null and undefined two hints of the difference between analysis, for each beginner should have no small use OH.
Generally known:Null = = undefinedBut:Null!== undefinedSo what's the difference between the
In JavaScript development, people ask: what is the difference between null and undefined? A bad time to answer, especially undefined, because it involves the implementation of undefined principle.General known: null = = undefinedHowever: null!==
In fact, I've listed all the "null" and "false" values in JavaScript, except that the Boolean value itself is true and false, "null values" for other data types are mainly undefined and defined. The types of these null values are:
The
It is hard to answer at a time, especially undefined, because it involves the implementation principle of undefined. So, after thinking about it, write down this article. Please take a look.Total offices: null = undefinedBut: null! = UndefinedSo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.